# -*- encoding:utf-8 -*-
from mako import runtime, filters, cache
UNDEFINED = runtime.UNDEFINED
__M_dict_builtin = dict
__M_locals_builtin = locals
_magic_number = 5
_modified_time = 1291860322.9138639
_template_filename='/Users/joeldunham/old/onlinelinguisticdatabase/templates/derived/source/view.html'
_template_uri='/derived/source/view.html'
_template_cache=cache.Cache(__name__, _modified_time)
_source_encoding='utf-8'
from webhelpers.html import escape
_exports = ['heading']


def _mako_get_namespace(context, name):
    try:
        return context.namespaces[(__name__, name)]
    except KeyError:
        _mako_generate_namespaces(context)
        return context.namespaces[(__name__, name)]
def _mako_generate_namespaces(context):
    # SOURCE LINE 2
    ns = runtime.Namespace(u'fileViews', context._clean_inheritance_tokens(), templateuri=u'/base/fileViews.html', callables=None, calling_uri=_template_uri, module=None)
    context.namespaces[(__name__, u'fileViews')] = ns

def _mako_inherit(template, context):
    _mako_generate_namespaces(context)
    return runtime._inherit_from(context, u'/base/index.html', _template_uri)
def render_body(context,**pageargs):
    context.caller_stack._push_frame()
    try:
        __M_locals = __M_dict_builtin(pageargs=pageargs)
        _import_ns = {}
        _mako_get_namespace(context, u'fileViews')._populate(_import_ns, [u'displayFile'])
        url = _import_ns.get('url', context.get('url', UNDEFINED))
        h = _import_ns.get('h', context.get('h', UNDEFINED))
        c = _import_ns.get('c', context.get('c', UNDEFINED))
        app_globals = _import_ns.get('app_globals', context.get('app_globals', UNDEFINED))
        displayFile = _import_ns.get('displayFile', context.get('displayFile', UNDEFINED))
        __M_writer = context.writer()
        # SOURCE LINE 1
        __M_writer(u'\n')
        # SOURCE LINE 2
        __M_writer(u'\n\n')
        # SOURCE LINE 6
        __M_writer(u'\n\n <h2><span class="emphasize">')
        # SOURCE LINE 8
        __M_writer(escape(c.source.title))
        __M_writer(u'</span></h2>\n\n')
        # SOURCE LINE 10
        if c.source.fullReference:
            # SOURCE LINE 11
            __M_writer(u' <p>')
            __M_writer(escape(c.source.fullReference))
            __M_writer(u'</p>\n')
            pass
        # SOURCE LINE 13
        __M_writer(u'\n')
        # SOURCE LINE 14
        if c.source.file:
            # SOURCE LINE 15
            __M_writer(u'    ')
            file = c.source.file 
            
            __M_locals_builtin_stored = __M_locals_builtin()
            __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key]) for __M_key in ['file'] if __M_key in __M_locals_builtin_stored]))
            __M_writer(u'\n')
            # SOURCE LINE 16
            if app_globals.allowedFileTypes[file.MIMEtype]:
                # SOURCE LINE 17
                __M_writer(u'      ')
                fileType = app_globals.allowedFileTypes[file.MIMEtype] 
                
                __M_locals_builtin_stored = __M_locals_builtin()
                __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key]) for __M_key in ['fileType'] if __M_key in __M_locals_builtin_stored]))
                __M_writer(u'\n')
                # SOURCE LINE 18
            else: 
                # SOURCE LINE 19
                __M_writer(u'      ')
                fileType = file.MIMEtype.split('/')[0] 
                
                __M_locals_builtin_stored = __M_locals_builtin()
                __M_locals.update(__M_dict_builtin([(__M_key, __M_locals_builtin_stored[__M_key]) for __M_key in ['fileType'] if __M_key in __M_locals_builtin_stored]))
                __M_writer(u'\n')
                pass
            # SOURCE LINE 21
            __M_writer(u'    <div class="associatedEntitiesDiv">\n     Associated File ')
            # SOURCE LINE 22
            __M_writer(escape(file.id))
            __M_writer(u': <span class="emphasize">')
            __M_writer(escape(file.name))
            __M_writer(u'</span> (')
            __M_writer(escape(h.pretty_filesize(file.size)))
            __M_writer(u')\n      <a href="')
            # SOURCE LINE 23
            __M_writer(escape(url(controller='file', action='view', id=file.id)))
            __M_writer(u'" class="buttonLink" title="')
            __M_writer(escape('Click to view more info about File %s' % file.id))
            __M_writer(u'">view</a>\n      ')
            # SOURCE LINE 24
            __M_writer(escape(displayFile(file, fileType)))
            __M_writer(u'\n    </div>\n    <br />\n')
            pass
        # SOURCE LINE 28
        __M_writer(u'\n<a href="')
        # SOURCE LINE 29
        __M_writer(escape(url(controller='source', action='edit', id=c.source.id)))
        __M_writer(u'" class="buttonLink" title="Edit this source">Edit</a>\n<a href="')
        # SOURCE LINE 30
        __M_writer(escape(url(controller='source', action='delete', id=c.source.id)))
        __M_writer(u'" class="buttonLink" onclick="return confirmDelete(\'Source\', \'')
        __M_writer(escape(c.source.authorLastName))
        __M_writer(u' (')
        __M_writer(escape(c.source.year))
        __M_writer(u')\')" title="Delete this source; confirmation will be required">Delete</a>\n')
        return ''
    finally:
        context.caller_stack._pop_frame()


def render_heading(context):
    context.caller_stack._push_frame()
    try:
        _import_ns = {}
        _mako_get_namespace(context, u'fileViews')._populate(_import_ns, [u'displayFile'])
        c = _import_ns.get('c', context.get('c', UNDEFINED))
        __M_writer = context.writer()
        # SOURCE LINE 4
        __M_writer(u'\n    <h1 class="heading">')
        # SOURCE LINE 5
        __M_writer(escape(c.source.authorLastName))
        __M_writer(u', ')
        __M_writer(escape(c.source.authorFirstName))
        __M_writer(u' (')
        __M_writer(escape(c.source.year))
        __M_writer(u')</h1>\n')
        return ''
    finally:
        context.caller_stack._pop_frame()


